<template>
	<!-- 竖向商品列表元素 -->
	<view class="my-goods" @click="active(item)">
		<view class="pic">
			<image :src="item.image" mode="aspectFill"></image>
			<view class="goods-price">￥{{item.price}}</view>
		</view>
		<view class="content">
			<view class="goods-name v-ellip-2">
				{{item.store_name}}
			</view>
			<view class="user-info" v-if="item.user">
				<image class="avatar" :src="item.user.avatar||''" mode="widthFix"></image>
				<view class="nickname">{{item.user.nickname||''}}</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		props:{
			item:{
				type: Object,
				default: function(){return {}}
			}
		},
		methods:{
			active(item){
				this.$emit("active", item.product_id || item.id);
			}
		}
	}
</script>

<style lang="scss" scoped>
	.my-goods{
		width: 350rpx;
		margin-bottom: 25rpx;
		.pic{
			position: relative;
			image{
				width: 350rpx;
				height: 350rpx;
				border-radius: 20rpx;
				border: 1px solid #ccc;
			}
			.goods-price{
				position: absolute;
				right: 20rpx;
				bottom: 20rpx;
				background-color: #000;
				border-radius: 10rpx;
				padding: 4rpx 10rpx;
				color: #fff;
			}
		}
		.content{
			.goods-name{
				width: 100%;
			}
			.user-info{
				display: flex;
				align-items: center;
				margin-top: 10rpx;
				.avatar{
					width: 50rpx;
					border-radius: 50%;
				}
				.nickname{
					color: #999;
					margin-left: 10rpx;
				}
			}
		}

	}
</style>